package org.apache.james.mime4j.field.datetime;

import java.io.PrintStream;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;

public class DateTime
{
  private final Date date;
  private final int day;
  private final int hour;
  private final int minute;
  private final int month;
  private final int second;
  private final int timeZone;
  private final int year;

  public DateTime(String paramString, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6)
  {
    this.year = convertToYear(paramString);
    this.date = convertToDate(this.year, paramInt1, paramInt2, paramInt3, paramInt4, paramInt5, paramInt6);
    this.month = paramInt1;
    this.day = paramInt2;
    this.hour = paramInt3;
    this.minute = paramInt4;
    this.second = paramInt5;
    this.timeZone = paramInt6;
  }

  public static Date convertToDate(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, int paramInt7)
  {
    GregorianCalendar localGregorianCalendar = new GregorianCalendar(TimeZone.getTimeZone("GMT+0"));
    localGregorianCalendar.set(paramInt1, paramInt2 - 1, paramInt3, paramInt4, paramInt5, paramInt6);
    localGregorianCalendar.set(14, 0);
    if (paramInt7 != -2147483648)
      localGregorianCalendar.add(12, -1 * (60 * paramInt7 / 100 + paramInt7 % 100));
    return localGregorianCalendar.getTime();
  }

  private int convertToYear(String paramString)
  {
    int j;
    int i = Integer.parseInt(paramString);
    switch (paramString.length())
    {
    default:
      j = i;
    case 1:
    case 2:
    case 3:
    }
    while (true)
    {
      while (true)
      {
        while (true)
        {
          return j;
          if ((i < 0) || (i >= 50))
            break;
          j = i + 2000;
        }
        j = i + 1900;
      }
      j = i + 1900;
    }
  }

  public boolean equals(Object paramObject)
  {
    int i;
    if (this == paramObject)
      i = 1;
    while (true)
    {
      while (true)
      {
        DateTime localDateTime;
        while (true)
        {
          while (true)
          {
            while (true)
            {
              while (true)
              {
                while (true)
                {
                  while (true)
                  {
                    while (true)
                    {
                      while (true)
                      {
                        while (true)
                        {
                          while (true)
                          {
                            return i;
                            if (paramObject != null)
                              break;
                            i = 0;
                          }
                          if (super.getClass() == paramObject.getClass())
                            break;
                          i = 0;
                        }
                        localDateTime = (DateTime)paramObject;
                        if (this.date != null)
                          break;
                        if (localDateTime.date == null)
                          break label77;
                        i = 0;
                      }
                      if (this.date.equals(localDateTime.date))
                        break;
                      i = 0;
                    }
                    label77: if (this.day == localDateTime.day)
                      break;
                    i = 0;
                  }
                  if (this.hour == localDateTime.hour)
                    break;
                  i = 0;
                }
                if (this.minute == localDateTime.minute)
                  break;
                i = 0;
              }
              if (this.month == localDateTime.month)
                break;
              i = 0;
            }
            if (this.second == localDateTime.second)
              break;
            i = 0;
          }
          if (this.timeZone == localDateTime.timeZone)
            break;
          i = 0;
        }
        if (this.year == localDateTime.year)
          break;
        i = 0;
      }
      i = 1;
    }
  }

  public Date getDate()
  {
    return this.date;
  }

  public int getDay()
  {
    return this.day;
  }

  public int getHour()
  {
    return this.hour;
  }

  public int getMinute()
  {
    return this.minute;
  }

  public int getMonth()
  {
    return this.month;
  }

  public int getSecond()
  {
    return this.second;
  }

  public int getTimeZone()
  {
    return this.timeZone;
  }

  public int getYear()
  {
    return this.year;
  }

  public int hashCode()
  {
    int i;
    (1 * 31);
    if (this.date == null)
      i = 0;
    while (true)
    {
      return (31 * (31 * (31 * (31 * (31 * (31 * (31 * (i + 31) + this.day) + this.hour) + this.minute) + this.month) + this.second) + this.timeZone) + this.year);
      i = this.date.hashCode();
    }
  }

  public void print()
  {
    System.out.println(toString());
  }

  public String toString()
  {
    return getYear() + " " + getMonth() + " " + getDay() + "; " + getHour() + " " + getMinute() + " " + getSecond() + " " + getTimeZone();
  }
}